package com.xcity.game.activity2.circle;

import naga.x.game.template.Template;
import naga.x.game.template.TemplateException;
import naga.x.game.template.annotation.Binding;
import naga.x.game.template.annotation.Excel;

/**
 * 欢乐转盘奖励
 * @author shipeng.zhu
 *
 */
@Excel(value = "circle.xlsx", sheetName = "转盘奖励")
public class CircleRewardTemplate extends Template {

	/** 奖励类型(1钱 2物品) */
	protected byte type;

	/** 奖励ID */
	protected int rewardId;
	
	/** 奖励物品ID */
	protected int rewardCount;
	
	/** 奖励图标 */
	protected String rewardIcon;

	/** 权重 */
	protected int weight;

	public byte getType() {
		return type;
	}

	public void setType(byte type) {
		this.type = type;
	}

	public int getRewardId() {
		return rewardId;
	}

	public void setRewardId(int rewardId) {
		this.rewardId = rewardId;
	}

	public int getWeight() {
		return weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	public int getRewardCount() {
		return rewardCount;
	}

	public void setRewardCount(int rewardCount) {
		this.rewardCount = rewardCount;
	}

	public String getRewardIcon() {
		return rewardIcon;
	}

	public void setRewardIcon(String rewardIcon) {
		this.rewardIcon = rewardIcon;
	}
	@Override
	public void validate() throws TemplateException {
		switch(type){
		case 1://钱
			if(rewardCount <= 0){
				throw new TemplateException("circle.xlsx欢乐转盘奖励类型错误->id=" + id);
			}
			break;
		case 2://物品
			if(rewardId <= 0 || rewardCount <= 0){
				throw new TemplateException("circle.xlsx欢乐转盘奖励类型错误->id=" + id);
			}
			break;
		default:
			throw new TemplateException("circle.xlsx欢乐转盘奖励类型错误->id=" + id);
		}
	}
}
